/** @typedef {{ time: number; content: string; }[]} LrcData */

/**
 * @type {function(string): LrcData}
 */
export const initData = R.compose(
  R.map(R.compose(
    R.zipObj(['time','content']),
    xs => [
      R.add(R.multiply(Number(xs[0]), 60), Number(xs[1])),
      R.last(xs),
    ],
    R.slice(1, Number.POSITIVE_INFINITY),
    R.match(/^\[(\d{2}):(\d{2})\.\d{2}\](.*)$/)
  )),
  R.split('\n')
);

/** @type {function(LrcData): string} */
export const LrcListHTML = R.compose(
  R.join(''),
  R.map(item => `<li data-time=${item.time}>${item.content}</li>`),
);
